home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _3F298E7ECB3444F7A61689364283ECB7 < prev    next >
Encoding:
Text File  |  2003-05-19  |  5.8 KB  |  250 lines

  1. <html>
  2. <head>
  3. <title><!--% WH_PROJECT_TITLE %--></title>
  4. <!--% FH_PROJECT_METATAGS %-->
  5. </head>
  6. <body>
  7. <script language="JavaScript">
  8. <!--
  9.  
  10. var gArrayCsh = new Array();
  11.  
  12. var gstrWindowOption = "";
  13. var gstrURL = "";
  14. var gbWithNavPane = false;
  15.  
  16. function CshEntityItem(strAliasId, nTopicNum, strUrl) 
  17. {
  18.     this.strAliasId = strAliasId;
  19.     this.nTopicNum = nTopicNum;
  20.     this.strUrl = strUrl;
  21. }
  22.  
  23.  
  24. //Try to get to topic number from hash string
  25. function GetTopicNumberAuto(strMayBeNumber)
  26. {
  27.    var nNum = -1;
  28.    if (strMayBeNumber.length >= 1)
  29.    {
  30.         var strTmp = strMayBeNumber;
  31.         var iEnd = strTmp.length;
  32.         for (var i=0; i<iEnd; i++)
  33.         {
  34.               var ch = strTmp.charAt(i);
  35.               if (!((ch == "0") || (ch == "1") ||
  36.                     (ch == "2") || (ch == "3") ||
  37.                     (ch == "4") || (ch == "5") ||
  38.                     (ch == "6") || (ch == "7") ||
  39.                     (ch == "8") || (ch == "9")))
  40.                   return GetTopicNumberById(strTmp);
  41.         }
  42.         nNum = parseInt(strTmp);
  43.    }
  44.    return nNum;
  45. }
  46.  
  47. function GetTopicNumber(strHashString)
  48. {
  49.     var nTopicEndPos = strHashString.indexOf(',')
  50.     if (nTopicEndPos == -1) { // no window option.
  51.         return GetTopicNumberOnly(strHashString);
  52.     }
  53.     else {
  54.         var strWindowOption = strHashString.substring(nTopicEndPos + 1, strHashString.length);
  55.         var strWithNavPane = 'withnavpane=true';
  56.         if (strWindowOption.toLowerCase().indexOf(strWithNavPane) == 0)
  57.         {
  58.             if (strWindowOption.length > strWithNavPane.length)
  59.                 gstrWindowOption = strWindowOption.substring(strWithNavPane.length + 1);
  60.             else
  61.                 gstrWindowOption = "";
  62.             gbWithNavPane = true;
  63.         }
  64.         else
  65.             gstrWindowOption = strWindowOption;
  66.         return GetTopicNumberOnly(strHashString.substring(0, nTopicEndPos));        
  67.     }
  68. }
  69.  
  70. function GetTopicNumberOnly(strTopicString)
  71. {
  72.     var nEqualPos = strTopicString.indexOf('=');
  73.     if (nEqualPos == -1) {
  74.         return GetTopicNumberAuto(strTopicString);
  75.     }
  76.     else {
  77.         var strValue=strTopicString.substring(nEqualPos + 1, strTopicString.length);
  78.         if (strTopicString.toLowerCase().indexOf("topicnumber") == 0) {
  79.             return parseInt(strValue);
  80.         } else if (strTopicString.toLowerCase().indexOf("topicid") == 0) {
  81.             return GetTopicNumberById(strValue);
  82.         } else if (strTopicString.toLowerCase().indexOf("remoteurl") == 0) {
  83.             gstrURL = strValue;
  84.             return -1;
  85.         }
  86.  
  87.     }
  88. }
  89.  
  90. //Find HomePage of the WebHelp system
  91. // we try to get the topic from remote project if it exists.
  92. function RedirectToHomePage()
  93. {
  94.     if (parent && parent != this && parent.goNext)
  95.     {
  96.         var sHome = parent.goNext();
  97.         if (sHome != "")
  98.             RedirectTo(sHome);
  99.     }
  100. }
  101.  
  102. function getHomePage()
  103. {
  104.     if (parent && parent != this && parent.getRelHomePage)
  105.     {
  106.         return parent.getRelHomePage(document.location.href);
  107.     }
  108.     return "";
  109. }
  110.  
  111. function addRemoteProject(strPath)
  112. {
  113.     if (parent && parent != this && parent.addProject)
  114.     {
  115.         parent.addProject(strPath);
  116.     }
  117. }
  118.  
  119. //Redirect page to...
  120. function RedirectTo(strUrl)
  121. {
  122.    if (gstrWindowOption.length != 0) {
  123.         var wnd = window.open(strUrl, "HelpStub", gstrWindowOption);
  124.         // close current window and rename the stub window to current window.
  125.         wnd.focus();
  126.         if (parent)
  127.             parent.close();
  128.    }
  129.    else {
  130.     parent.document.location.href = strUrl;
  131.     window.focus();
  132.   }
  133. }
  134.  
  135. //Prompt the user that we can not find...
  136. function FailToFind(strMsg)
  137. {
  138.     RedirectToHomePage();
  139. }
  140.  
  141. //Find topic by topic number (defined in h file)
  142. function FindTopicByTopicNum(nTopicNum)
  143. {
  144.     var i = 0;
  145.     var iEnd = gArrayCsh.length;
  146.     for (i=0; i<iEnd; i++)
  147.     {
  148.         if (gArrayCsh[i].nTopicNum == nTopicNum)
  149.         {
  150.             var strURL = gArrayCsh[i].strUrl;
  151.             if (gbWithNavPane)
  152.             {
  153.                 var strHomePage = getHomePage();
  154.                 if (strHomePage.length != 0)
  155.                     strURL = strHomePage + strURL;
  156.             }    
  157.             RedirectTo(strURL);
  158.             return true;
  159.         }
  160.     }
  161.     FailToFind("Fail to find topic assocaite with topic number: " + nTopicNum);
  162.     return false;
  163. }
  164.  
  165. //Find topic by topic id (alias id defined in ali file)
  166. function GetTopicNumberById(strTopicId)
  167. {
  168.    var i = 0;
  169.    var iEnd = gArrayCsh.length;
  170.    for (i=0; i<iEnd; i++)
  171.    {
  172.     if (gArrayCsh[i].strAliasId == strTopicId)
  173.     {
  174.         return gArrayCsh[i].nTopicNum;
  175.      }
  176.    }
  177.    gstrURL = "";
  178.    return -1;
  179. }
  180.  
  181. //Set Context-sensitive help entity...
  182. function SetCsh(n, strAliasId, nTopicNum, strUrl)
  183. {
  184.    gArrayCsh[n] = new CshEntityItem(strAliasId,nTopicNum,strUrl);
  185. }
  186.  
  187.  
  188. function getHash()
  189. {
  190.     if (parent && parent != this)
  191.         return parent.location.hash;
  192.     else
  193.         return "";
  194. }
  195. //-->
  196. </script>
  197. <script language="javascript">
  198. <!--% "<!-";"-"    %-->
  199. <!--% OutputWebHelpCshDataBlock.htm("  SetCsh(%d,\"%s\",%d,\"%s\");\r\n"); %-->
  200. <!--% OutputRemoteProjectBlock.htm("  addRemoteProject(\"%s\");\r\n"); %-->
  201. <!--% "//-";"->" %-->
  202. </script>
  203. <script language="javascript">
  204. <!--
  205. //Find CSH according to hash string after this page
  206. if (getHash().length > 0)
  207. {
  208.    // VH 05/16/00 now support 
  209.    // TopicID=
  210.    // TopicNumber=
  211.    // RemoteURL=   
  212.    // and WindowsOptions
  213.    // with the format #a=xxx,b=xxx,c=xxx...
  214.    var strHashString = getHash().toString();
  215.    // change ? to : for remote URL. because java applet have some problem to pass a URL with two : inside the URL so we changed it. 
  216.    // so here need to change it back.
  217.    strHashString = strHashString.substring(1,strHashString.length);
  218.    strHashString = strHashString.replace("%072%057%057", "://");
  219.    var nTopicNum = GetTopicNumber(strHashString);
  220.  
  221.    if (nTopicNum != -1)
  222.    {
  223.       FindTopicByTopicNum(nTopicNum);
  224.    }
  225.    else
  226.    {
  227.       if (gstrURL.length > 0) 
  228.     RedirectTo(gstrURL);
  229.       else
  230.           RedirectToHomePage();
  231.    }
  232. }
  233. else
  234. {
  235.    RedirectToHomePage();
  236. }
  237. //-->
  238. </script>
  239. <noscript>
  240.  <p> Your browser does not support JavaScript. WebHelp Context-Sensitive Help requires JavaScript support to run.</p>
  241. </noscript>
  242. </body>
  243. </html>
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.